<?php

class Gas_fee_stat_collection extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'Gas_fee_stat_collection':
	 * @var integer $id
	 * @var string $plate_no
	 * @var string $main_driver_name
	 * @var string $type_name
	 * @var double $fuel
	 * @var double $actual_gas_fee
	 * @var double $early_odometer_no
	 * @var double $end_odometer_no
	 * @var double $total_mileage
	 * @var double $front_driving_mileage
	 * @var double $empty_driving_mileage
	 * @var double $light_driving_mileage
	 * @var double $heavy_driving_mileage
	 * @var double $front_fuel
	 * @var double $empty_fuel
	 * @var double $light_fuel
	 * @var double $heavy_fuel
	 * @var double $ideal_gas_fee
	 * @var double $incentive_amount
	 * @var string $stat_date
	 * @var integer $state
	 * @var string $ceate_time
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'gas_fee_stat_collection';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('plate_no','length','max'=>10),
			array('main_driver_name','length','max'=>30),
			array('type_name','length','max'=>20),
			array('id, state', 'numerical', 'integerOnly'=>true),
			array('fuel, actual_gas_fee, early_odometer_no, end_odometer_no, total_mileage, front_driving_mileage, empty_driving_mileage, light_driving_mileage, heavy_driving_mileage, front_fuel, empty_fuel, light_fuel, heavy_fuel, ideal_gas_fee, incentive_amount', 'numerical'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => '索引',
			'plate_no' => '车牌号',
			'main_driver_name' => '主车司机',
			'type_name' => '车型',
			'fuel' => '容积',
			'actual_gas_fee' => '油费金额',
			'early_odometer_no' => '月初表数',
			'end_odometer_no' => '月末表数',
			'total_mileage' => '共行驶',
			'front_driving_mileage' => '车头里程',
			'empty_driving_mileage' => '空驶里程',
			'light_driving_mileage' => '轻驶里程',
			'heavy_driving_mileage' => '重驶里程',
			'front_fuel' => '车头标耗',
			'empty_fuel' => '空驶标耗',
			'light_fuel' => '轻驶标耗',
			'heavy_fuel' => '重驶标耗',
			'ideal_gas_fee' => '标耗容积',
			'incentive_amount' => '奖惩金额',
			'stat_date' => '统计时间',
			'state' => '状态',
			'create_time' => '创建时间',
		);
	}
	
	public function excelAttributes(){//导出excel所需的字段名、列号、宽度
		return array(
			'plate_no'=>array('B',10),
			'main_driver_name'=>array('C',10),
			'type_name'=>array('D',18),
			'fuel'=>array('E',10,'sum'=>true),
			'actual_gas_fee'=>array('F',10,'sum'=>true),
			'early_odometer_no'=>array('G',10),
			'end_odometer_no'=>array('H',10),
			'total_mileage'=>array('I',10,'sum'=>true),
			'front_driving_mileage'=>array('J',10,'sum'=>true),
			'empty_driving_mileage'=>array('K',10,'sum'=>true),
			'light_driving_mileage'=>array('L',10,'sum'=>true),
			'heavy_driving_mileage'=>array('M',10,'sum'=>true),
			'front_fuel'=>array('N',10),
			'empty_fuel'=>array('O',10),
			'light_fuel'=>array('P',10),
			'heavy_fuel'=>array('Q',10),
			'ideal_gas_fee'=>array('R',10,'sum'=>true),
			'incentive_amount'=>array('S',10,'sum'=>true),
			'stat_date'=>array('T',10),
		);
	}
}